<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form name="form1" id="form1">
			用户名:
		</form>

		<form id="form2">
			选择年份<select id="sel1"></select>
		</form>

		<button onclick="add()">添加</button>

		<script>
			function add() {

				var txt = document.createElement("input")

				txt.type = "text";
				txt.name = "username"

				form1.appendChild(txt);
			}


			var op1 = document.createElement("option");

			var op1txt = document.createTextNode("2024");

			op1.appendChild(op1txt);

			sel1.appendChild(op1);
		</script>
	</body>
</html>